home *** CD-ROM | disk | FTP | other *** search
/ Cre@te Online 2000 December / Cre@teOnline CD05.iso / MacSoft / XML ConsoleMax.sea / XML ConsoleMax / Required / esc.jar / com / extensibility / esc / AProgressBarPanel.class (.txt) < prev    next >
Encoding:
Java Class File  |  2000-06-30  |  3.4 KB  |  149 lines

  1. package com.extensibility.esc;
  2.  
  3. import java.awt.BorderLayout;
  4. import java.awt.Component;
  5. import java.awt.Container;
  6. import java.awt.FlowLayout;
  7. import javax.swing.JButton;
  8. import javax.swing.JLabel;
  9. import javax.swing.JPanel;
  10. import javax.swing.JProgressBar;
  11.  
  12. public abstract class AProgressBarPanel extends JPanel {
  13.    // $FF: renamed from: pb javax.swing.JProgressBar
  14.    protected JProgressBar field_0;
  15.    protected int MIN;
  16.    protected int MAX;
  17.    protected float increment;
  18.    protected JLabel mainMsg;
  19.    protected JLabel valFile;
  20.    protected JLabel valNumber;
  21.    protected JLabel percent;
  22.    protected JLabel ofMax;
  23.    // $FF: renamed from: up javax.swing.JPanel
  24.    protected JPanel field_1;
  25.    protected JPanel center;
  26.    protected JPanel down;
  27.    protected float oldValue;
  28.    JButton btCancel;
  29.  
  30.    protected abstract void prepareUpPanel();
  31.  
  32.    public AProgressBarPanel() {
  33.       this(0, 100);
  34.    }
  35.  
  36.    public AProgressBarPanel(int var1, int var2) {
  37.       super(new BorderLayout());
  38.       this.MIN = 0;
  39.       this.MAX = 100;
  40.       this.increment = 0.0F;
  41.       this.oldValue = 0.0F;
  42.       this.setMIN(var1);
  43.       this.setMAX(var2);
  44.       this.field_0 = new JProgressBar();
  45.       this.field_0.setMinimum(this.MIN);
  46.       this.field_0.setMaximum(this.MAX);
  47.       this.field_1 = new JPanel(new FlowLayout());
  48.       this.prepareUpPanel();
  49.       this.center = new JPanel(new BorderLayout());
  50.       JPanel var3 = new JPanel(new FlowLayout());
  51.       ((Container)var3).add(this.field_0);
  52.       this.percent = new JLabel(String.valueOf(this.MIN));
  53.       JLabel var4 = new JLabel("%");
  54.       ((Container)var3).add(this.percent);
  55.       ((Container)var3).add(var4);
  56.       this.center.add(var3, "North");
  57.       JPanel var5 = new JPanel(new FlowLayout());
  58.       this.valNumber = new JLabel(String.valueOf(this.MIN));
  59.       ((Container)var5).add(this.valNumber);
  60.       ((Container)var5).add(this.ofMax);
  61.       this.center.add(var5, "Center");
  62.       this.down = new JPanel(new BorderLayout());
  63.       JPanel var6 = new JPanel();
  64.       this.btCancel = new JButton("Cancel");
  65.       this.btCancel.setActionCommand("cancel");
  66.       ((Container)var6).add(this.btCancel);
  67.       this.down.add(var6, "Center");
  68.       ((Container)this).add(this.field_1, "North");
  69.       ((Container)this).add(this.center, "Center");
  70.       ((Container)this).add(this.down, "South");
  71.       ((Component)this).resize(300, 300);
  72.    }
  73.  
  74.    public int getMIN() {
  75.       return this.MIN;
  76.    }
  77.  
  78.    public void setMIN(int var1) {
  79.       this.MIN = var1;
  80.    }
  81.  
  82.    public int getMAX() {
  83.       return this.MAX;
  84.    }
  85.  
  86.    public void setMAX(int var1) {
  87.       this.MAX = var1;
  88.       if (this.ofMax == null) {
  89.          this.ofMax = new JLabel(String.valueOf(" of ").concat(String.valueOf(String.valueOf(this.MAX))));
  90.       } else {
  91.          this.ofMax.setText(String.valueOf(" of ").concat(String.valueOf(String.valueOf(this.MAX))));
  92.       }
  93.  
  94.       this.setIncrement(100.0F / (this.MAX == 0 ? 1.0F : (float)this.MAX));
  95.    }
  96.  
  97.    public float getIncrement() {
  98.       return this.increment;
  99.    }
  100.  
  101.    public void setIncrement(float var1) {
  102.       this.increment = var1;
  103.    }
  104.  
  105.    public void next(float var1) {
  106.       int var2 = Integer.parseInt(this.valNumber.getText());
  107.       this.oldValue = var1;
  108.       int var3 = (int)this.oldValue;
  109.       this.valNumber.setText(String.valueOf(var2 + 1));
  110.       if (this.oldValue >= (float)100) {
  111.          this.field_0.setValue(100);
  112.          this.percent.setText(String.valueOf(100));
  113.          this.oldValue = 0.0F;
  114.       } else {
  115.          this.field_0.setValue(var3);
  116.          this.percent.setText(String.valueOf(var3));
  117.       }
  118.  
  119.    }
  120.  
  121.    public void next() {
  122.       this.next(this.oldValue + this.increment);
  123.    }
  124.  
  125.    public void setValFiles(String[] var1) {
  126.       this.valFile.setText(var1[0]);
  127.    }
  128.  
  129.    public void reset() {
  130.       this.oldValue = 0.0F;
  131.       this.valNumber.setText("0");
  132.       this.valFile.setText("");
  133.       this.field_0.setValue(0);
  134.       this.percent.setText("0");
  135.    }
  136.  
  137.    public JLabel getMainMsg() {
  138.       return this.mainMsg;
  139.    }
  140.  
  141.    public void setMainMsg(JLabel var1) {
  142.       this.mainMsg = var1;
  143.    }
  144.  
  145.    public void setMainMsg(String var1) {
  146.       this.setMainMsg(new JLabel(var1));
  147.    }
  148. }
  149.